package com.cdl.interfaces;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.time.Instant;
import java.time.*;
import javax.swing.*;

/**
 * @author cdl
 * @date 2025/10/5
 */
public class TimerTest {
    public static void main(String[] args) {
        TimePrinter listener = new TimePrinter();
        Timer timer = new Timer(5000,listener);
        timer.start();

        JOptionPane.showMessageDialog(null, "Quit the program");
        System.exit(0);


    }
}

class TimePrinter implements ActionListener {
    public void actionPerformed(ActionEvent e) {
        System.out.println("At the tone, the time is " + Instant.ofEpochMilli(e.getWhen()));
        Toolkit.getDefaultToolkit().beep();

    }
}
